__author__ = 'Administrator'
import unittest
from testRunner.runner import *
from testCase.home.Home import *
from testCase.myinfo.login import *
from testCase.home.Home import *
from testReport.htmlreport import *
import datetime
from testRunner.testServer import AppiumServer
def runnerCaseApp():

    suite = unittest.TestSuite()
    starttime = datetime.datetime.now()
    suite.addTest(TestInterfaceCase.parametrize(testLogin))
    suite.addTest(TestInterfaceCase.parametrize(testHome))
    unittest.TextTestRunner(verbosity=2).run(suite)
    endtime = datetime.datetime.now()
    common.time_took = (endtime - starttime).seconds
    print(common.time_took)
# web 入口
def runnerCaseWeb(runner):
    pass
if __name__ == '__main__':
    if ga.platformName == common.ANDROID or ga.platformName == common.IOS:
        appium_server = AppiumServer(ga.appiumJs, ga.Remote)
        appium_server.start_server()
        while not appium_server.is_runnnig():
            time.sleep(1)
        runnerCaseApp()
        html_report1 = HtmlReport()
        html_report1.data = common.RRPORT
        html_report1.generate_html( r'd:\\app\\appium_study\\testReport\\report.html')
        appium_server.stop_server()
